package com.cf.cachedcrud.entity;

import com.cf.cache.core.Cached;
import com.cf.crud.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.Transient;


public abstract class CacheEntity extends BaseEntity implements Cached {

    @Transient
    @JsonIgnore
    private String cacheKey;

    @Override
    public String getCacheKey() {
        return this.getClass().getSimpleName() + "-" + this.getId();
    }

    public void setCacheKey(String cacheKey) {
        this.cacheKey = cacheKey;
    }
}
